load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "genyaml.go",
        "populate_struct.go",
    ],
    data = ["//prow/plugins:config-src"],
    importpath = "k8s.io/test-infra/pkg/genyaml",
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_clarketm_json//:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
        "@in_gopkg_yaml_v3//:go_default_library",
        "@io_k8s_apimachinery//pkg/util/sets:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "genyaml_test.go",
        "populate_struct_test.go",
    ],
    data = [":test-data"],
    embed = [":go_default_library"],
    deps = [
        "//pkg/genyaml/testdata/alias_simple_types:go_default_library",
        "//pkg/genyaml/testdata/alias_types:go_default_library",
        "//pkg/genyaml/testdata/embedded_structs:go_default_library",
        "//pkg/genyaml/testdata/inline_structs:go_default_library",
        "//pkg/genyaml/testdata/interface_types:go_default_library",
        "//pkg/genyaml/testdata/multiline_comments:go_default_library",
        "//pkg/genyaml/testdata/nested_structs:go_default_library",
        "//pkg/genyaml/testdata/no_tags:go_default_library",
        "//pkg/genyaml/testdata/omit_if_empty:go_default_library",
        "//pkg/genyaml/testdata/pointer_types:go_default_library",
        "//pkg/genyaml/testdata/primitive_types:go_default_library",
        "//pkg/genyaml/testdata/private_members:go_default_library",
        "//pkg/genyaml/testdata/sequence_items:go_default_library",
        "@in_gopkg_yaml_v3//:go_default_library",
    ],
)

filegroup(
    name = "test-data",
    srcs = [
        "//pkg/genyaml/testdata/alias_simple_types:test-data",
        "//pkg/genyaml/testdata/alias_types:test-data",
        "//pkg/genyaml/testdata/embedded_structs:test-data",
        "//pkg/genyaml/testdata/inject_comments:test-data",
        "//pkg/genyaml/testdata/inline_structs:test-data",
        "//pkg/genyaml/testdata/interface_types:test-data",
        "//pkg/genyaml/testdata/multiline_comments:test-data",
        "//pkg/genyaml/testdata/multiple_paths:test-data",
        "//pkg/genyaml/testdata/nested_structs:test-data",
        "//pkg/genyaml/testdata/no_tags:test-data",
        "//pkg/genyaml/testdata/omit_if_empty:test-data",
        "//pkg/genyaml/testdata/pointer_types:test-data",
        "//pkg/genyaml/testdata/primitive_types:test-data",
        "//pkg/genyaml/testdata/private_members:test-data",
        "//pkg/genyaml/testdata/sequence_items:test-data",
        "//pkg/genyaml/testdata/set_path_overwrite:test-data",
        "//pkg/genyaml/testdata/single_path:test-data",
    ],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [
        ":package-srcs",
        "//pkg/genyaml/testdata/alias_simple_types:all-srcs",
        "//pkg/genyaml/testdata/alias_types:all-srcs",
        "//pkg/genyaml/testdata/embedded_structs:all-srcs",
        "//pkg/genyaml/testdata/inject_comments:all-srcs",
        "//pkg/genyaml/testdata/inline_structs:all-srcs",
        "//pkg/genyaml/testdata/interface_types:all-srcs",
        "//pkg/genyaml/testdata/multiline_comments:all-srcs",
        "//pkg/genyaml/testdata/multiple_paths:all-srcs",
        "//pkg/genyaml/testdata/nested_structs:all-srcs",
        "//pkg/genyaml/testdata/no_tags:all-srcs",
        "//pkg/genyaml/testdata/omit_if_empty:all-srcs",
        "//pkg/genyaml/testdata/pointer_types:all-srcs",
        "//pkg/genyaml/testdata/primitive_types:all-srcs",
        "//pkg/genyaml/testdata/private_members:all-srcs",
        "//pkg/genyaml/testdata/sequence_items:all-srcs",
        "//pkg/genyaml/testdata/set_path_overwrite:all-srcs",
        "//pkg/genyaml/testdata/single_path:all-srcs",
    ],
    tags = ["automanaged"],
    visibility = ["//visibility:public"],
)
